package com.yupi.yupicturebackend.api.imageSearch;

import com.yupi.yupicturebackend.api.imageSearch.model.ImageSearchResult;
import com.yupi.yupicturebackend.api.imageSearch.sub.GetImageFirstUrlApi;
import com.yupi.yupicturebackend.api.imageSearch.sub.GetImageListApi;
import com.yupi.yupicturebackend.api.imageSearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * 以图搜图门面
 */
@Slf4j
public class ImageSearchApiFacade {
    public static List<ImageSearchResult> searchImages(String imageUrl) {
        String imagePageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(imagePageUrl);
        return GetImageListApi.getImageList(imageFirstUrl);
    }

    public static void main(String[] args) {
        String imageUrl = "https://www.codefather.cn/logo.png";
        List<ImageSearchResult> imageSearchResults = searchImages(imageUrl);
        System.out.println(imageSearchResults);
    }
}
